package cn.zjn.test.springboot.controller;

import cn.zjn.test.springboot.domain.Plan;
import cn.zjn.test.springboot.domain.User;
import cn.zjn.test.springboot.service.MResourcesService;
import cn.zjn.test.springboot.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.relational.core.sql.In;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.*;

/**
 * @Author: Zjn *Bring it on!!!*
 * @Date: 2021/2/1 16:16
 * Note:成员页资源
 */
@RestController
public class MemResourcesController {
    @Autowired
    MResourcesService mResourcesService;

    @GetMapping("/getUsers")
    public JsonResult getUsers() {
//        ArrayList<Object> objects = new ArrayList<>();
//        objects.add(mResourcesService.getUsers());
//        objects.add(mResourcesService.getUserId());
        return new JsonResult(List.of(mResourcesService.getUsers()),"200","操作成功");
    }

    @PostMapping("/personal")
    public JsonResult personal(@RequestBody User user){
        return new JsonResult(List.of(mResourcesService.getUser(user.getUSERID())),"200","操作成功");
    }

    @PostMapping("planGet")
    public JsonResult planGet(@RequestBody Map<String,Integer> map) {
        return new JsonResult(List.of(mResourcesService.planGet(map.get("userid"),map.get("type")),"200","操作成功"));
    }

}
